home *** CD-ROM | disk | FTP | other *** search
/ VRML Browsing & Building Cyberspace / VRML - Browsing and Building Cyberspace.iso / examples / ninth.wrl < prev    next >
Text File  |  1995-06-13  |  2KB  |  75 lines

  1. #VRML V1.0 ascii
  2.  
  3. # Example nine - create a link from the Sun to an HTML document
  4.  
  5. # Here comes the Sun
  6. # The Separator node groups everything within it together
  7. Separator {
  8.  
  9.     # The material will effect all subsequent nodes
  10.     # The sun is yellow, isn't it?  Additive color means red + green = yellow
  11.     # We're switching to emissive color because the Sun gives off light.
  12.     Material {
  13.         emissiveColor 1 1 0        # The Sun emits lots of yellow light
  14.     }
  15.  
  16.     # The WWWAnchor node is a group node
  17.     # This means that all objects within it are linked with the anchor's URL
  18.     # We want to link the Sun, so the Sun's Sphere node goes inside of it.
  19.     # Using the description field, we provide context for the user
  20.     WWWAnchor {
  21.         name "http://www.w3.org/" # The root URL of the World Wide Web
  22.         description "A link from the Sun to W3.ORG" # Decriptive text
  23.  
  24.         # Inside the anchor, because WWWAnchor is a group node
  25.         Sphere {
  26.             radius 10        # Big Sun
  27.         }
  28.     }
  29.  
  30.     # We place the Earth within it's own Separator
  31.     # To keep everything good and isolated
  32.     Separator {
  33.  
  34.         # Let's move things out of the way here
  35.         Transform {
  36.             translation 0 20 20
  37.         }
  38.  
  39.         # Color the Earth blue, and make it absorb light
  40.         # But also make it a reflective, like water
  41.         Material {
  42.             diffuseColor 0 0 1 # Big blue marble
  43.             shininess 0.9 # Water is rather shiny
  44.         }
  45.  
  46.         # Finally, create the earth
  47.         Sphere {
  48.             radius 2    # Little Earth
  49.         }
  50.  
  51.         # The Moon gets its own Separator
  52.         # Because we really do keep everything separate
  53.         Separator {
  54.  
  55.             # The Moon is just outside the Earth
  56.             Transform {
  57.                 translation 4 4 0
  58.             }
  59.  
  60.             # Color the Moon grey, make it absorb light
  61.             # It's a little shiny, but not much
  62.             Material {
  63.                 diffuseColor 0.7 0.7 0.7
  64.                 shininess 0.3
  65.             }
  66.  
  67.             # And now, create the Moon
  68.             Sphere {
  69.                 radius 1    # Tiny Moon
  70.             }
  71.         }
  72.     }
  73. }
  74.  
  75.